package com.heima.wemedia;


import com.heima.feigns.AdminFeign;
import com.heima.file.service.FileStorageService;
import com.heima.file.service.impl.OSSAliyunFileStorageService;
import com.heima.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.nio.file.Files;

@SpringBootTest
@Slf4j
public class wemedia {


    @Autowired
    FileStorageService fileStorageService;

    @Value("${file.oss.web-site}")
    String  webSite;


    @Test
    public  void  test() throws FileNotFoundException {
        //读取的本地文件的全路径
//        FileInputStream inputStream = new FileInputStream(new File("D:\\壁纸\\哔哩哔哩一期\\1.jpg"));
//        //文件上传对象                               云的文件名                     定义的名字           输出流
//        String wemedia = fileStorageService.store("hmtt-bucket1", "aaa1.jpg", inputStream);
//        //输出全地址
//        System.out.println(webSite+wemedia);

        // 删除文件

        fileStorageService.delete("hmtt-bucket1/2022/1/20220101/aaa1.jpg");


    }

    @Autowired
    AdminFeign adminFeign;
    @Test
    public void test123(){
        ResponseResult responseResult = adminFeign.selectAllSensitives();
        System.out.println(responseResult.getData());
    }

}








